<template>
  <div class="container">
    <normal-title
      title="物流信息"
      :back="true"
    ></normal-title>
    <div
      class="main"
      v-if="expressInfo!==null"
    >
      <div class="session">
        <div class="item-name">收货地址</div>
        <div class="address">{{orderInfo.province+orderInfo.city+orderInfo.country+orderInfo.address}}</div>
        <div class="user-info">{{orderInfo.receiver_name}} &nbsp;&nbsp;&nbsp;&nbsp; 电话：{{orderInfo.phone}}</div>
      </div>
      <div
        class="session"
        style="padding:30rpx 30rpx 0 30rpx"
      >
        <div class="item-name">{{orderInfo.express}}</div>
        <div class="express-no">运单号：{{orderInfo.express_no}}</div>
        <div class="line"></div>
        <div
          class="row"
          v-for="(item,index) in expressInfo.data"
          :key="index"
        >
          <div class="col">
            <!-- <img
              class="exp-icon"
              src="../../images/exp-finish.png"
              mode="aspectFit"
            > -->
            <div class="dot"></div>
            <div
              v-if="index!=expressInfo.data.length-1"
              class="col-line"
            ></div>
          </div>
          <div class="exp-detail">
            <div class="exp-info">{{item.status}}</div>
            <div class="date">{{item.time}}</div>
          </div>
        </div>

      </div>
    </div>
    <bottom-btn />
  </div>
</template>

<script>
import { request } from '@/utils'
import NormalTitle from '@/components/NormalTitle'
import BottomBtn from '@/components/BottomBtn'
export default {
  components: {
    NormalTitle,
    BottomBtn
  },
  data () {
    return {
      expressInfo: null,
      orderInfo: null
    }
  },
  methods: {
    async getInfo () {
      var order_id = this.$root.$mp.query.order_id
      var res = await request('/v1/order/' + order_id, 'get')
      this.orderInfo = res.data
      var res = await request('/v1/order/express-search', 'get', {
        express_no: this.orderInfo.express_no
      })
      this.expressInfo = res.data
    }
  },
  mounted () {
    this.getInfo()
  }
}
</script>

<style>
page {
  height: 100%;
  background: #f0f0f0;
}
</style>

<style scoped lang="scss">
.container {
  .main {
    color: #747474;
    padding: 25rpx;
    font-size: 24rpx;
    .session {
      padding: 30rpx;
      margin-bottom: 30rpx;
      background: #fff;
      border-radius: 20rpx;
      .item-name {
        font-size: 34rpx;
        font-weight: 500;
        color: #000;
      }
      .address {
        margin: 10rpx 0;
        font-size: 26rpx;
      }
      .user-info {
        font-size: 26rpx;
      }
      .express-no {
        color: #d5c095;
        font-size: 26rpx;
        margin-top: 10rpx;
      }
      .line {
        height: 3rpx;
        margin: 15rpx 0 30rpx;
        background: #f6f6f6;
      }
      .row {
        align-items: flex-start;
        position: relative;
      }
      .col {
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        align-items: center;
        position: absolute;
        width: 40rpx;
        .exp-icon {
          width: 40rpx;
          height: 40rpx;
        }
        .dot {
          width: 15rpx;
          height: 15rpx;
          background: #c9c9c9;
          border-radius: 50%;
        }
        .col-line {
          width: 5rpx;
          height: 100%;
          background: #ebebeb;
        }
      }
      .exp-detail {
        margin: -10rpx 0 45rpx 60rpx;
        .date {
          font-size: 20rpx;
        }
      }
    }
  }
}
</style>




